package com.zhouzj.task.dubbo.provider;

import com.zhouzj.task.dubbo.api.TaskService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * @Author: zhouzhijun
 * @Date: 2021/7/20 17:20
 */
@Service
public class TaskServiceImpl implements TaskService {
    @Override
    public void methodA() {
        System.out.println("methodA");
        sleep();
    }

    @Override
    public void methodB() {
        System.out.println("methodB");
        sleep();
    }

    @Override
    public void methodC() {
        System.out.println("methodC");
        sleep();
    }

    private void sleep(){
        try {
            TimeUnit.MILLISECONDS.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
